#include "zoom_widget.h"


ZoomWidget::ZoomWidget(int value, QWidget *parent)
    : QSpinBox(parent)
{
    setButtonSymbols(QAbstractSpinBox::NoButtons);
    setRange(1, 1000);
    setSuffix(" %");
    setValue(value);
    setToolTip("Zoom Level");
    setStatusTip(toolTip());
    setAlignment(Qt::AlignCenter);
}

QSize ZoomWidget::minimumSizeHint() const
{
    int height = QSpinBox::minimumSizeHint().height();
    QFontMetrics fm(font());
    int width = fm.horizontalAdvance(QString::number(maximum()));
    return QSize(width, height);
}
